<template>
	<view v-if="banner_list.length!=0">
		<swiper :style="'width: '+swiperWidth+';height: '+swiperHeight+';'" class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay"
			:interval="interval" :duration="duration">
			<swiper-item v-for="(item,index) in banner_list">
				<view class="swiper-item" @click="to(item)">
					<image :src="item.imgUrl" mode="aspectFill"></image>
				</view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		name:"swiperList",
		props:['swiperWidth','swiperHeight','position'],
		data() {
			return {
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				banner_list:[]
			};
		},
		created() {
			this.get_banner()
		},
		methods:{
			get_banner()
			{
				var _this=this;
				var data={position:this.position}
				this.$NoteApi.doRequest('get',"banner/findByPosition",data,'json').then(res=>{
					_this.banner_list=res.data.data
				})
			},
			to(item){
				var data={
					id:item.id
				}
				this.$NoteApi.doRequest("post",'banner/reportOpen',data,'json').then(res=>{
					
				})
				uni.navigateTo({
					url:"/pages/webView/webView?url="+item.jumpUrl
				})
			}
		}
		

	}
</script>

<style>
	.swiper-item{
		width: 100%;
		height: 100%;
		border-radius: 10upx;
		
	}
	.swiper-item image{
		width: 100%;
		height: 100%;
		border-radius: 10upx;
	}

</style>